package com.bigData.main.mapper;

import com.bigData.main.pojo.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserRegisterMapper {
    @Insert("insert into  user_info(uid,uname ,upass ,uroot) values (#{uid},#{uname},#{upass} ,#{uroot})")
    Integer insertUser(UserInfo u);

    @Insert("insert into  user_info(uname ,upass, uroot) values (#{uname},#{upass} ,#{uroot})")
    Integer insertRoot(UserInfo u);

    @Update("UPDATE  user_info SET uroot = #{uroot} WHERE uname = #{uname} OR uid = #{uid}")
    Integer updateUser(UserInfo u);

    @Delete("DELETE FROM  user_info WHERE uid = #{uid} OR uname = #{uname}")
    Integer deleteUser(UserInfo u);

    @Select("select upass from  user_info where uname=#{uname}")
    UserInfo getUserName(UserInfo u);

    @Select("select upass from  user_info where uname=#{uname}")
    UserInfo getRootName(UserInfo u);

    @Select("SELECT * FROM  user_info ")
    List<UserInfo> user();

    @Select("SELECT uroot FROM  user_info where uid = #{uid}")
    Integer uroot(UserInfo u);


}
